//聊天数据全部在这里模拟
import Mock from 'mockjs'

const data = Mock.mock({
  "data|10": [
    {
      'proname': '@clast',
      'proid': '@sentence(3, 5)',
      'proimage': '@image("150x150","@color","劳务")',
      'createTime': '@datetime'
    }
  ]
})


Mock.mock('/getProListData', 'get', () => {
  return data
})



//删除数据
Mock.mock('/del', 'post', (config) => {
  const req = JSON.parse(config.body)

  let res = {
    code: '200',
    msg: '删除失败'
  }

  //遍历 data 找到要修改的对象, 修改即可
  data.forEach((item, index) => {
    //找到要删除的对象
    if (item.proid == req.proid) {
      //在数组中删除一个数据
      data.splice(index, 1)

      res.msg = '删除成功'
    }
  })

  return res
})